var reclamo = {
		
		init : function(){
			
			$.loadModal('Guardando reclamo....');	
			
			

			$("#txtTelefono").keypress(function(e){

				// NOTA: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
		        var key = e.which;
		        if (!(key <= 13 || (key >= 48 && key <= 57))) {
		        	e.preventDefault();
		        	$("#errorTelefono").css("display","inline");

		        }
		        else{
		        	
		        	$("#errorTelefono").css("display","none");
		        }

			});
			
			$("#txtDni").keypress(function(e){

				// NOTA: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
		        var key = e.which;
		        if (!(key <= 13 || (key >= 48 && key <= 57))) {
		        	e.preventDefault();
		        	$("#errorDni").css("display","inline");

		        }
		        else{
		        	
		        	$("#errorDni").css("display","none");
		        }

			});
			
			$("#txtCelular").keypress(function(e){

				// NOTA: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
		        var key = e.which;
		        if (!(key <= 13 || (key >= 48 && key <= 57))) {
		        	e.preventDefault();
		        	$("#errorCelular").css("display","inline");

		        }
		        else{
		        	
		        	$("#errorCelular").css("display","none");
		        }

			});
			
			$("#cbotipo").change(function(){
				
				var a = $(this).val();
				
				if(a == "Internet"){
					
					$("#cbomotivo").append("<option value='1'>Cortes</option><option value='1'>baja velocidad</option>");
				}else{
					$("#cbomotivo").html("");
					$("#cbomotivo").append("<option value='1'>no llego recibo</option><option value='1'>cobro excesivo</option>");
					
				}
			});
			
			$("#btnReclamo").click(function(){
				
				var telefono = $("#txtTelefono");
				var persona = $("#txtReclamoHechoPor");
				var dni = $("#txtDni");
				var email = $("#txtEmail");
				
				if(validateFieldBlank(telefono.val())){
					
					alert("Ingresar Telefono");
					persona.focus();
					return false;
				}
				
				if(validateFieldBlank(persona.val())){
					
					alert("Ingresar Persona que hace el reclamo");
					dni.focus();
					return false;
				}
				
				if(validateFieldBlank(dni.val())){
					
					alert("Ingresar Dni");
					dni.focus();
					return false;
				}
				

				if(validateFieldBlank(email.val())){
					
					alert("Ingresar Email");
					email.focus();
					return false;
				}
				
				if(!checkEmailb(email)){
					
					return false;
				}
				
				$.loadModal.start();
				setTimeout("jQuery.loadModal.changeTextDialog('Nro 00004578R')",5000);
	    		setTimeout("jQuery.loadModal.stop()",10000);
			});
			
		}
		
		
};

$(document).ready(reclamo.init);

